//
//  GuaHaoInfoCell.m
//  guahao
//
//  Created by osx on 16/10/7.
//  Copyright © 2016年 osx. All rights reserved.
//

#import "GuaHaoInfoCell.h"

@interface GuaHaoInfoCell ()
@property (weak, nonatomic) IBOutlet UILabel *HospitalName;
@property (weak, nonatomic) IBOutlet UILabel *DoctorName;
@property (weak, nonatomic) IBOutlet UILabel *date;
@property (weak, nonatomic) IBOutlet UILabel *DepartmentName;

@end


@implementation GuaHaoInfoCell

//快速获得cell
+ (instancetype)cellWithTableView:(UITableView*)tableView{
    static NSString* ID=@"yuyueguahao";
    GuaHaoInfoCell* cell=[tableView dequeueReusableCellWithIdentifier:ID];
    if (cell==nil) {
        cell=[[[NSBundle mainBundle]loadNibNamed:NSStringFromClass(self) owner:nil options:nil]lastObject];
    }
    return cell;
}
- (void)setModel:(GuaHaoInfoModel *)model{
    _model=model;
    self.HospitalName.text=model.HospitalName;
    self.DepartmentName.text=model.DepartmentName;
    NSString *s = model.dates;
    self.date.text = s;
   // self.date.text= [s substringWithRange:NSMakeRange(0, s.length-5)];
    self.DoctorName.text=model.DoctorName;
    //self.HsptImage.image=[UIImage imageNamed:model.HospitalImage];
    [self layoutIfNeeded];
    CGFloat need=CGRectGetMaxY(self.date.frame);
    model.h=need+10;
}

/*
- (void)setModel:(GuaHaoInfoModel *)model{
    _model=model;
    self.HospitalName.text=model.HospitalName;
    self.DepartmentName.text=model.DepartmentName;
    
   // NSDate *d = [NSDate alloc] initw
    NSDateFormatter *datefor = [[NSDateFormatter alloc] init];
    [datefor setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    
    NSString *s = [datefor stringFromDate:self.model.dates];
    self.date.text = s;
   // self.date.text= [s substringWithRange:NSMakeRange(0, s.length-5)];
    self.DoctorName.text=model.DoctorName;
    //self.HsptImage.image=[UIImage imageNamed:model.HospitalImage];
    [self layoutIfNeeded];
    CGFloat need=CGRectGetMaxY(self.date.frame);
    model.h=need+10;
}
*/

- (void)awakeFromNib {
    self.date.preferredMaxLayoutWidth=[UIScreen mainScreen].bounds.size.width-16;//为了保证计算出来的数值和显示出来的一致
}

@end
